<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .static {
            border: 1px solid #ccc;
            width: 100px;
            height: 100px;
        }

        .active {
            background-color: green;
        }

        .text-danger {
            color: red;
        }
    </style>
</head>

<body>
    <div id="app">
        <h1>{{msg}}</h1>
        <!-- 静态写法 -->
        <div class="static active text-danger">{{msg}}</div>
        <!-- 动态写法:动静结合 -->
        <div class="static" :class="['active','text-denger']">{{msg}}</div>
        <div class="static" :class="[c1,c2]">{{msg}}</div>
        <!-- 适用场景：当样式的个数不确定，并且样式的名字也不确定的时候 可以采用数组形式-->
        <div class="static" :class="classArray">{{msg}}</div>
    </div>
    <script src="js/vue.js"></script>
    <script>
        const vm = new Vue({
            el: '#app',
            data: {
                msg: 'class数组形式',
                c1: 'active',
                c2: 'text-danger',
                classArray: ['active', 'text-danger']
            }
        })
    </script>
</body>

</html>